import unittest


class DomeTestCase(unittest.TestCase):
    @classmethod
    def setUpClass(cls) -> None:
        print('所有test开始运行执行一次')

    def setUp(self) -> None:
        print('每个测试方法运行前执行')

    def tearDown(self) -> None:
        print('每个测试方法结束后执行')

    @unittest.skip('跳过的原因')
    def test01(self):
        self.assertEqual(1,1,msg='失败')

    @unittest.skipIf(1==1,'条件成立跳过')
    def test02(self):
        self.assertEqual(2,1,msg='失败')

    @unittest.expectedFailure   # 预期失败跳过
    def test03(self):
        self.assertNotEqual(1,1,msg='失败')

    @unittest.skipUnless(1 == 2,'条件不成立跳过的原因')
    def test04(self):
        self.assertNotEqual(1, 2, msg='失败')

    @classmethod
    def tearDownClass(cls) -> None:
        print('所有test结束执行一次')


if __name__ == '__main__':
    unittest.main(verbosity=2)
